package ss.pku.jsa.type.inference;

public class DummyLocation extends Location {
	private String desc = "";
	private long line = 0L;
	private long fp = 0L;
	// private static int nextNativeIndex = 1;

	public static final Location conservativeAssumptionLocation = new Location(
			"(Assumptions made for type without available source code)", 0L, 0L);

	public DummyLocation(String desc) {
		super("(Assumptions made for type without available source code)", 0, 0);
		this.desc = desc;
	}

	public long getLine() {
		return this.line;
	}

	public long getFilePosition() {
		return this.fp;
	}

	public String getFileName() {
		throw new UnsupportedOperationException(
				"Cannot call this method on DummyLocation");
	}

	public void setLine(long line) {
		throw new UnsupportedOperationException(
				"Cannot call this method on DummyLocation");
	}

	public void setFilePosition(long fp) {
		throw new UnsupportedOperationException(
				"Cannot call this method on DummyLocation");
	}

	public void setFileName(String name) {
		throw new UnsupportedOperationException(
				"Cannot call this method on DummyLocation");
	}

	public int getNativeIndex() {
		return this.nativeIndex;
	}

	public boolean equals(Object o) {
		if (!(o instanceof DummyLocation))
			return false;
		DummyLocation l = (DummyLocation) o;
		return l.nativeIndex == this.nativeIndex;
	}

	public int hashCode() {
		return this.desc.hashCode();
	}

	public String toString() {
		if (this.desc != null)
			return this.desc;
		return "loc: " + this.nativeIndex;
	}
}
